package com.example.ponycui_home.svgaplayer;

import com.opensource.svgaplayer.utils.log.LogUtil;
import ohos.aafwk.ability.AbilityPackage;
import ohos.app.Context;
import ohos.net.HttpResponseCache;

import java.io.File;
import java.io.IOException;

/**
 * ex.
 *
 * @author wl
 * @since 2021-06-22
 */
public class MyApplication extends AbilityPackage {
    @Override
    public void onInitialize() {
        super.onInitialize();
        File cacheDir = new File(this.getCacheDir(), "http");
        if (!cacheDir.exists()){
            boolean mkdirs = cacheDir.mkdirs();
            if (!mkdirs){
                LogUtil.loge("cacheDir make dirs fail");
            }
        }
        try {
            HttpResponseCache.install(cacheDir, 1024 * 1024 * 128);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
